<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/1/19
  Time: 18:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <title>查看商品页面</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
    <script src="../../layuiadmin/layui/layui.js" charset="utf-8"></script>
    <!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
    <style  type="text/css">
        .layui-form layui-border-box layui-table-view{
            margin-top: 0px;
            height: 100%;
        }
        .demoTable{
            margin-top: 0px;
        }
    </style>
    <script src="../../js/jquery.min.3.1.0.js"></script>
</head>
<body>

<table class="layui-table" lay-data="{ height:500, url:'/QueryWareServlet?wareId=${wareId}', page:true, id:'idTest'}"
       lay-filter="demo">
    <thead>
    <tr>
        <th lay-data="{type:'numbers', width:100, fixed: 'left'}">序号</th>
        <th lay-data="{field:'goName', width:200, align:'center'}" >商品名称</th>
        <th lay-data="{field:'goPrice', width:120, align:'center' }">商品价格</th>
        <th lay-data="{field:'goSalesVolume', width:120, align:'center'}">商品销量</th>
        <th lay-data="{field:'goUptime', maxwidth:300, align:'center'}">上架时间</th>
    </tr>
    </thead>
</table>
<script>
    layui.use('table', function () {
        var table = layui.table;
        //监听表格复选框选择
        table.on('checkbox(demo)', function (obj) {
            console.log(obj)
        });
        //监听单元格编辑
        table.on('edit(test)', function (obj) {
            var value = obj.value //得到修改后的值
                , data = obj.data //得到所在行所有键值
                , field = obj.field; //得到字段
            layer.msg('[ID: ' + data.noticeId + '] ' + field + ' 字段更改为：' + value);
        });


        var $ = layui.$, active = {
          reload: function () {
                var name = $('#name');
                var na = name.val();
                //执行重载
                table.reload('idTest', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    , where: {
                        name: na,
                    }
                });
            }
        };
    });
</script>
</body>
</html>

